package com.lightboat.system.domain;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lightboat.common.annotation.Excel;
import com.lightboat.common.core.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.SchemaProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 商品库存记录对象 crm_product_stock_record
 * 
 * @author lightboat
 * @date 2025-09-12
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Schema(title = "商品库存记录")
@TableName(value = "crm_product_stock_record", autoResultMap = true)
public class CrmProductStockRecord extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** 主键ID */
    @SchemaProperty(name = "主键ID")
    @TableId
    private Long id;

    /** 商品ID */
    @SchemaProperty(name = "商品ID")
    @Excel(name = "商品ID")
    private Long productId;

    /** 订单ID */
    @SchemaProperty(name = "订单ID")
    @Excel(name = "订单ID")
    private Long orderId;

    /** 原库存 */
    @SchemaProperty(name = "原库存")
    @Excel(name = "原库存")
    private Long originalStock;

    /** 变化数量 */
    @SchemaProperty(name = "变化数量")
    @Excel(name = "变化数量")
    private Long changeQuantity;

    /** 剩余库存 */
    @SchemaProperty(name = "剩余库存")
    @Excel(name = "剩余库存")
    private Long remainingStock;

    /** 操作类型（1入库 2出库） */
    @SchemaProperty(name = "操作类型（1入库 2出库）")
    @Excel(name = "操作类型", readConverterExp = "1=入库,2=出库")
    private Integer operationType;

    /** 订单状态（1下单 2补货 3退货） */
    @SchemaProperty(name = "订单状态（1下单 2补货 3退货）")
    @Excel(name = "订单状态", readConverterExp = "1=下单,2=补货,3=退货")
    private Integer orderStatus;


    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("productId", getProductId())
            .append("orderId", getOrderId())
            .append("originalStock", getOriginalStock())
            .append("changeQuantity", getChangeQuantity())
            .append("remainingStock", getRemainingStock())
            .append("operationType", getOperationType())
            .append("orderStatus", getOrderStatus())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }
}
